﻿<UserControl x:Class="Esponce.Views.DecodeView"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:m="clr-namespace:Esponce.Models"
	xmlns:v="clr-namespace:Esponce.Views"
	xmlns:control="clr-namespace:LoadingControl.Control"
  mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="800">
	<UserControl.DataContext>
		<m:DecodeViewModel />
	</UserControl.DataContext>
	<Grid x:Name="LayoutRoot">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*" />
			<ColumnDefinition Width="20" />
			<ColumnDefinition Width="*" />
		</Grid.ColumnDefinitions>

		<!-- Input -->
		<Grid Grid.Column="0">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="10" />
				<RowDefinition Height="*" />
			</Grid.RowDefinitions>

			<TextBlock Grid.Row="0" Text="INPUT: QR CODE" Style="{StaticResource TitleStyle}" />

			<Border Grid.Row="2" Style="{StaticResource BorderStyle}" AllowDrop="True" MouseLeftButtonDown="Border_MouseLeftButtonDown" Drop="Border_Drop">
				<Grid Margin="20">
					<TextBlock Text="(drag and drop QR code or click here)" IsHitTestVisible="False" HorizontalAlignment="Center" VerticalAlignment="Center" />

					<!-- QR Code Preview -->
					<Image Source="{Binding ImageSource}" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="False" />
				</Grid>
			</Border>
		</Grid>

		<!-- Result -->
		<Grid Grid.Column="2">

			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="10" />
				<RowDefinition Height="*" />
			</Grid.RowDefinitions>

			<TextBlock Grid.Row="0" Text="OUTPUT: CONTENT" Style="{StaticResource TitleStyle}" />

			<Border Grid.Row="2" Style="{StaticResource BorderStyle}">
				<Grid Margin="20">
					<TextBox Text="{Binding Content}" TextWrapping="Wrap" IsReadOnly="True" Opacity="{Binding PreviewOpacity}" />

					<!-- Loading animation -->
					<control:LoadingAnimation HorizontalAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="False" IsLoading="{Binding IsLoading}" Visibility="{Binding IsLoading, Converter={StaticResource VisibilityConverter}}" />
				</Grid>
			</Border>

		</Grid>
	</Grid>
</UserControl>
